-
Notifications
You must be signed in to change notification settings - Fork 24.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Protect NodeConnectionsService from stale conns #92558
Protect NodeConnectionsService from stale conns #92558
Conversation
A call to `ConnectionTarget#connect` which happens strictly after all calls that close connections should leave us connected to the target. However concurrent calls to `ConnectionTarget#connect` can overlap, and today this means that a connection returned from an earlier call may overwrite one from a later call. The trouble is that the earlier connection attempt may yield a closed connection (it was concurrent with the disconnections) so we must not let it supersede the newer one. With this commit we prevent concurrent connection attempts, which avoids earlier attempts from overwriting the connections resulting from later attempts. When combined with elastic#92546, closes elastic#92029
Hi @DaveCTurner, I've created a changelog YAML for you. |
Pinging @elastic/es-distributed (Team:Distributed) |
A different (possibly simpler?) approach from #92555. We should choose one. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, I like using synchronized better than #92555 's approach of using atomic values! Because it makes the code/logic simpler to understand.
Just have one small question you could answer before approval.
server/src/main/java/org/elasticsearch/cluster/NodeConnectionsService.java
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
A call to `ConnectionTarget#connect` which happens strictly after all calls that close connections should leave us connected to the target. However concurrent calls to `ConnectionTarget#connect` can overlap, and today this means that a connection returned from an earlier call may overwrite one from a later call. The trouble is that the earlier connection attempt may yield a closed connection (it was concurrent with the disconnections) so we must not let it supersede the newer one. With this commit we prevent concurrent connection attempts, which avoids earlier attempts from overwriting the connections resulting from later attempts. Backport of elastic#92558 When combined with elastic#101910, closes elastic#100493
A call to `ConnectionTarget#connect` which happens strictly after all calls that close connections should leave us connected to the target. However concurrent calls to `ConnectionTarget#connect` can overlap, and today this means that a connection returned from an earlier call may overwrite one from a later call. The trouble is that the earlier connection attempt may yield a closed connection (it was concurrent with the disconnections) so we must not let it supersede the newer one. With this commit we prevent concurrent connection attempts, which avoids earlier attempts from overwriting the connections resulting from later attempts. Backport of #92558 When combined with #101910, closes #100493
A call to
ConnectionTarget#connect
which happens strictly after all calls that close connections should leave us connected to the target. However concurrent calls toConnectionTarget#connect
can overlap, and today this means that a connection returned from an earlier call may overwrite one from a later call. The trouble is that the earlier connection attempt may yield a closed connection (it was concurrent with the disconnections) so we must not let it supersede the newer one.With this commit we prevent concurrent connection attempts, which avoids earlier attempts from overwriting the connections resulting from later attempts.
When combined with #92546, closes #92029